package top.igotcha.chapter.chapter3.threadRunningOrder;

import java.util.concurrent.locks.LockSupport;

/**
 * @author Gotcha
 * @date 2021/3/8
 * @describe
 */
public class ParkUnPark {
    public static void main(String[] args) {
        Thread t2 = new Thread(()->{
            LockSupport.park();
            System.out.println("线程t2开始运行");
        },"t2");

        Thread t1 = new Thread(()->{
            System.out.println("线程t1开始运行");
            LockSupport.unpark(t2);
        },"t1");

        t1.start();
        t2.start();
    }
}
